﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace MT.ControlLibrary.Controls
{
    public class TreeViewItemWithCheckBox : TreeViewItem
    {
        /// <summary>
        /// CheckBox是否选中
        /// </summary>
        public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register("IsChecked", typeof(bool), typeof(TreeViewItemWithCheckBox), new PropertyMetadata(false));
        public bool IsChecked
        {
            get { return (bool)GetValue(IsCheckedProperty); }
            set { SetValue(IsCheckedProperty, value); }
        }

        /// <summary>
        /// The command property
        /// </summary>
        public static readonly DependencyProperty CheckedCommandProperty = DependencyProperty.Register("CheckedCommand", typeof(ICommand), typeof(TreeViewItemWithCheckBox), new PropertyMetadata(default(ICommand)));
        public ICommand CheckedCommand
        {
            get { return (ICommand)GetValue(CheckedCommandProperty); }
            set { SetValue(CheckedCommandProperty, value); }
        }

        /// <summary>
        ///  The command Parameter
        /// </summary>
        public static readonly DependencyProperty CheckedCommandParameterProperty = DependencyProperty.Register("CheckedCommandParameter", typeof(object), typeof(TreeViewItemWithCheckBox), new PropertyMetadata(default(object)));
        public object CheckedCommandParameter
        {
            get { return (object)GetValue(CheckedCommandParameterProperty); }
            set { SetValue(CheckedCommandParameterProperty, value); }
        }


        static TreeViewItemWithCheckBox()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(TreeViewItemWithCheckBox), new FrameworkPropertyMetadata(typeof(TreeViewItemWithCheckBox)));
        }

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
        }
    }
}
